home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / JZWRTFIL.C < prev    next >
Text File  |  1988-12-18  |  858b  |  42 lines

  1.  
  2. /*
  3. ┌────────────────────────────────────────────────────────────────────────────┐
  4. │ jzwrtfil                                     │
  5. │ Read from a file handle                             │
  6. │ Parms                                      │
  7. │   fhandle    Handle to read from                         │
  8. │   fbuf    Buffer to write from                         │
  9. │   famt    Number of bytes requested to write                 │
  10. │   Returns the number of bytes actually written                 │
  11. └────────────────────────────────────────────────────────────────────────────┘
  12. */
  13.  
  14. #include <jaz.h>
  15.  
  16. jzwrtfil(fhandle,fbuf,famt)
  17. int fhandle;
  18. char *fbuf;
  19. int famt;
  20. {
  21.   TREG wreg;
  22.  
  23.   wreg.h.ah = 0x40;        /* write file function */
  24.  
  25.   wreg.x.bx = fhandle;
  26.  
  27.   wreg.x.ds = getds();
  28.  
  29.   wreg.x.dx = (int) fbuf;
  30.  
  31.   wreg.x.cx = famt;
  32.  
  33.   msdos(&wreg);
  34.  
  35.   if (wreg.x.flags & 1)
  36.     return(-1);
  37.   else
  38.     return(wreg.x.ax);        /* number of bytes actually read */
  39.  
  40. }
  41.  
  42.